package com.byf.product.factory;

import com.byf.common.core.domain.Result;
import com.byf.product.domain.PmsSkuInfo;
import com.byf.product.RemotePmsSkuInfoService;
import com.byf.product.domain.PmsSkuSaleAttrValue;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 用户服务降级处理
 *
 * @author byf
 */
@Component
public class RemotePmsSkuInfoFallbackFactory implements FallbackFactory<RemotePmsSkuInfoService>
{
    private static final Logger log = LoggerFactory.getLogger(RemotePmsSkuInfoFallbackFactory.class);

    @Override
    public RemotePmsSkuInfoService create(Throwable cause) {
        return new RemotePmsSkuInfoService() {
            @Override
            public Result<PmsSkuInfo> getInfo(Long skuId) {
                return Result.error("获取sku信息详细信息失败:" + cause.getMessage());
            }

            @Override
            public Result<List<PmsSkuSaleAttrValue>> selectPmsSkuSaleAttrValueList(PmsSkuSaleAttrValue pmsSkuSaleAttrValue) {
                return Result.error("查询sku属性信息列表:" + cause.getMessage());
            }
        };
    }
}
